@model CreateSitemapIndexViewModel

<h1>@RenderTitleSegments(T["Create Sitemap Index"])</h1>

@if (String.IsNullOrEmpty(Site.BaseUrl))
{
    <p class="alert alert-warning">@T["The site settings 'Base url' property is empty, but is required to generate sitemaps."]</p>
}

<div asp-validation-summary="ModelOnly"></div>
<form asp-action="Create" method="post">

    <div class="form-group" asp-validation-class-for="Name">
        <label asp-for="Name">@T["Name"]</label>
        <input asp-for="Name" class="form-control" autofocus />
        <span asp-validation-for="Name" class="text-danger">@T["The name is required."]</span>
    </div>

    <div class="form-group" asp-validation-class-for="Path">
        <label asp-for="Path">@T["Permalink"]</label>
        <div class="input-group">
            @if (!String.IsNullOrWhiteSpace(Site.BaseUrl))
            {
                <div class="input-group-prepend">
                    <div class="input-group-text">@Site.BaseUrl</div>
                </div>
            }
            <input asp-for="Path" class="form-control" />
            <span asp-validation-for="Path"></span>
        </div>
        <span class="hint">@T["The url of the sitemap index."]</span>
    </div>

    <div class="form-group custom-control custom-checkbox">
        <input asp-for="Enabled" class="custom-control-input" />
        <label asp-for="Enabled" class="custom-control-label">@T["Enabled"]</label>
        <span class="hint">@T["Uncheck to disable routing to the sitemap index."]</span>
    </div>

    <div class="form-group">
        <label asp-for="ContainableSitemaps">@T["Contained Sitemaps"]</label>
        <span class="hint">@T["The sitemaps this index contains."]</span>
        <div class="row">
            @for (int i = 0; i < Model.ContainableSitemaps.Length; i++)
            {
                <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 col-xl-2">
                    <input hidden asp-for="@Model.ContainableSitemaps[i].SitemapId" />
                    <input hidden asp-for="@Model.ContainableSitemaps[i].Name" />
                    <div class="custom-control custom-checkbox">
                        <input asp-for="@Model.ContainableSitemaps[i].IsChecked" class="custom-control-input" />
                        <label asp-for="@Model.ContainableSitemaps[i].IsChecked" class="custom-control-label">@Model.ContainableSitemaps[i].Name</label>
                    </div>
                </div>
            }
        </div>
    </div>

    <div class="form-group">
        <button class="btn btn-primary" type="submit">@T["Save"]</button>
        <a class="btn btn-secondary" asp-controller="SitemapIndex" asp-action="List" asp-area="OrchardCore.Sitemaps">@T["Cancel"]</a>
    </div>
</form>
